const fs = require('fs');
const { Writable } = require('node:stream');

const outStream = new Writable({
  write(chunk, encoding, callback) {
    console.log(chunk.toString(), encoding);
    this.push(chunk)
    callback();
  }
});

const file = outStream.createWriteStream('example.txt');

outStream.write('hello, ');
outStream.end('world!');
